<template>
	<view class="page-my">
		<!-- 头部 -->
		<view class="header bg-blue">
			<!-- 个人信息 -->
			<view class="info">
				<u-avatar :src="userInfo.avatar" shape="circle" size="60"></u-avatar>
				<view class="detail">
					<view class="text-xl">{{userInfo.username}}</view>
					<view class="tag">代理商编号：{{userInfo.user_id}}</view>
				</view>
			</view>
		</view> 
		<view class="money">
			<view class="msg">
				<view class="item tc" v-for="(item, index) in mainList" :key="index">
					<navigator :url="item.path" hover-class="none">
						<image class="margin-top-sm" :src="item.image" style="width:60rpx;height:60rpx;" mode=""></image>
						<view class="margin-top-sm">{{item.title}}</view>
					</navigator>
				</view>
				
			</view>
		</view>
		
		<view class="cu-list menu margin-top" style="border-bottom: 1px solid #efefef;">
			<view class="cu-item arrow" @tap="toService('/pages/my/serviceConsultation')">
				<view class="content">
					<text class="text-black text-lg" style="">咨询服务</text>
				</view>
				
			</view>
			<view class="cu-item arrow" @tap="toService('/pages/my/Feedback')">
				<view class="content">
					<text class="text-black text-lg" style="">意见反馈</text>
				</view>
			</view>
		</view>
		<view class="cu-list menu margin-top" style="border-bottom: 1px solid #efefef;">
			<view class="cu-item arrow" @tap="toService('/pages/my/page?id=5')">
				<view class="content">
					<text class="text-black text-lg" style="">关于易能付</text>
				</view>
				
			</view>
			<view class="cu-item arrow" @tap="toService('/pages/user/login')">
				<view class="content">
					<text class="text-black text-lg" style="">退出登录</text>
				</view>
			</view>
			<view class="cu-item arrow" @tap="toService('/pages/my/page?id=6')">
				<view class="content">
					<text class="text-black text-lg" style="">隐私政策</text>
				</view>
			</view>
			<view class="cu-item arrow" @tap="toService('/pages/my/version')">
				<view class="content">
					<text class="text-black text-lg" style="">版本号</text>
				</view>
				<view class="jiaoyi">
					<text class="w-txt-999 w-font-18">{{version}}</text>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
export default {
	data() {
		return {
			userInfo: {},
			mainList: [
				{
					color:"green",
					icon: "setting-fill",
					image: "/static/icon/my0.png",
					title: "商户管理",
					path: '/pages/my/merchantSup'
				},
				
				{
					color:"blue",
					icon: "plus-people-fill",
					image: "/static/icon/my1.png",
					title: "代理商管理",
					path: '/pages/my/daili'
				},
				{
					color:"orange",
					icon: "account-fill",
					image: "/static/icon/my2.png",
					title: "二维码管理",
					path: '/pages/my/codeList'
				}
			],
			version: '1.0.0'
		};
	},
	onShow() {
		this.getUserInfo()
	},
	onLoad() {
		// #ifdef APP-PLUS
		plus.runtime.getProperty(plus.runtime.appid,(wgtinfo)=>{
			this.version = wgtinfo.version
		})
		// #endif
		
	},
	methods: {
		getUserInfo () {
			if (!uni.getStorageSync("token")) {
				uni.showToast({
					title: '请登录后操作',
					icon: 'none',
					duration: 1500,
					success: (res)=> {
						setTimeout(()=>{
							uni.reLaunch({
								url: '/pages/user/login'
							});
						},1000)
					}
				});
				return
			}
			this.userInfo = uni.getStorageSync("YNF_INFO")
		},
		
		//去其他服务页
		toService(url){
			uni.navigateTo({
				url: url,
			});
		}
	},
	
	
	
};
</script>

<style scoped lang="scss">
page {
	background: #f5f5f5;
}
.page-my {
	padding-bottom: 50rpx;
	.header {
		position: relative;
		height: 400rpx;
		.bg {
			width: 100%;
			height: 100%;
		}
		.info {
			position: absolute;
			display: flex;
			align-items: center;
			left: 0;
			top: 100rpx;
			padding: 0 32rpx;

			.detail {
				margin-left: 18rpx;
				.tag {
					margin-top: 18rpx;
					display: inline-block;
					position: relative;
					padding: 6rpx 18rpx;
					color: #ffffff;
					font-size: 28rpx;
					background: rgba(255, 255, 255, 0.3);
					border-radius: 26rpx;
				}
			}
		}
	}
	.money {
		position: relative;
		padding: 40rpx 30rpx;
		box-sizing: border-box;
		margin: -120rpx auto 0 auto;
		width: 690rpx;
		background: #ffffff;
		border-radius: 16rpx;
		.msg {
			display: flex;
			.item {
	
				flex: 1;
				text-align: center;
			}
		}
	}
	
}
</style>
